package kyssion.leetcode.num101_150;

public class code136_重复的数字 {
    public static void main(String[] args) {
        System.out.println(new code136_重复的数字().singleNumber(
                new int[]{
                        4, 1, 2, 2, 1
                }
        ));
    }

    public int singleNumber(int[] nums) {
        if (nums.length == 0) {
            return 0;
        }
        for (int a = 1; a < nums.length; a++) {
            nums[0] ^= nums[a];
        }
        return nums[0];
    }
}
